package connector;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.StringTokenizer;
import mediator.MBroker;
import entity.Order;
import entity.Taxi;
import entity.Taxi.Status;

public class CDBConnector {

	public void prepareDBSaving(int taxiid, int driverID, Status status, long time,
			float latitude, float longtitude) {
		Taxi currentTaxi = Taxi.taxis.get(Integer.toString(taxiid));
		Calendar date = Calendar.getInstance();
		date.setTimeInMillis(time);
		currentTaxi.getPosition().setNewPosition(latitude, longtitude, date);
		currentTaxi.setStatus(status);
		MBroker aBroker = MBroker.getInstance();
		aBroker.dematerializePosition(currentTaxi); 
	}
	
	public void prepareOrderSaving(Order order)
	{	
		Order aOrder = order;
		MBroker aBroker = MBroker.getInstance();
		aBroker.dematerializeOrder(order);	
	}
}
